<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <script type="text/javascript" src="vendor/blockly/blockly_compressed.js"></script>
    <script type="text/javascript" src="vendor/blockly/blocks_compressed.js"></script>
    <script type="text/javascript" src="vendor/blockly/javascript_compressed.js"></script>
    <script type="text/javascript" src="vendor/blockly/msg/js/zh_cn.js"></script>
    <script type="text/javascript" src="blocks.js"></script>
    <style>
      html, body {
        background-color: #fff;
        margin: 0;
        padding: 0;
        overflow: hidden;
        height: 100%;
      }
      .blocklySvg {
        height: 100%;
        width: 100%;
      }
    </style>
    <script>

      function init() {
        Blockly.inject(document.body, {
          path: '../../', 
          toolbox: document.getElementById('toolbox')
        });
        // Dispatch the event.
        var domEvent  = new CustomEvent('blocklyReady', {detail:{ Blockly: Blockly}})
        window.parent.dispatchEvent(domEvent);
      }
    </script>
  </head>
  <body onload="init()">
    <xml id="toolbox" style="display: none">
      <!-- Minecraft Category -->
      <category name='我的世界'>
        <block type="draw_skin"></block>
        <block type="draw_skymap"></block>
        <block type="draw_nickname"></block>
        <block type="draw_say"></block>
        <block type="draw_move">
          <value name="DISTANCE">
            <block type="math_number">
              <title name="NUM">0.5</title>
            </block>
          </value>
        </block>
        <block type="draw_turn">
          <value name="ANGLE">
            <block type="math_number">
              <title name="NUM">45</title>
            </block>
          </value>
        </block>
        <block type="text"></block>
      </category>
      <!-- Controls Category -->
      <category name="控制">
        <block type="controls_if"></block>
        <block type="controls_repeat_ext"></block>
        <block type="controls_whileUntil"></block>
        <block type="controls_for"></block>
        <block type="controls_forEach"></block>
        <block type="controls_flow_statements"></block>
      </category>
      <!-- Math Category -->
      <category name="数学"> 
        <block type="math_number"></block>
        <block type="math_arithmetic"></block>
        <block type="math_single"></block>
        <block type="math_trig"></block>
        <block type="math_constant"></block>
        <block type="math_number_property"></block>
        <block type="math_change">
          <value name="DELTA">
            <block type="math_number">
              <title name="NUM">1</title>
            </block>
          </value>
        </block>
        <block type="math_round"></block>
        <block type="math_on_list"></block>
        <block type="math_modulo"></block>
        <block type="math_constrain">
          <value name="LOW">
            <block type="math_number">
              <title name="NUM">1</title>
            </block>
          </value>
          <value name="HIGH">
            <block type="math_number">
              <title name="NUM">100</title>
            </block>
          </value>
        </block>
        <block type="math_random_int">
          <value name="FROM">
            <block type="math_number">
              <title name="NUM">1</title>
            </block>
          </value>
          <value name="TO">
            <block type="math_number">
              <title name="NUM">100</title>
            </block>
          </value>
        </block>
        <block type="math_random_float"></block>
      </category>
      <!-- Variables Category -->
      <category name="变量" custom="VARIABLE"></category>
      <!-- List Category -->
      <category name="列表">
        <block type="lists_create_empty"></block>
        <block type="lists_create_with"></block>
        <block type="lists_repeat">
          <value name="NUM">
            <block type="math_number">
              <title name="NUM">5</title>
            </block>
          </value>
        </block>
        <block type="lists_length"></block>
        <block type="lists_isEmpty"></block>
        <block type="lists_indexOf">
          <value name="VALUE">
            <block type="variables_get">
              <title name="VAR">list</title>
            </block>
          </value>
        </block>
        <block type="lists_getIndex">
          <value name="VALUE">
            <block type="variables_get">
              <title name="VAR">list</title>
            </block>
          </value>
        </block>
        <block type="lists_setIndex">
          <value name="LIST">
            <block type="variables_get">
              <title name="VAR">list</title>
            </block>
          </value>
        </block>
        <block type="lists_getSublist">
          <value name="LIST">
            <block type="variables_get">
              <title name="VAR">list</title>
            </block>
          </value>
        </block>
      </category>
    </xml>
  </body>
</html>
